package com.coder.algorithm.leetcode

/**
 * [26. 删除有序数组中的重复项](https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/)
 *
 * @author yuhus
 * @date: 2022/3/30
 */
object l_0026 {
    fun removeDuplicates(nums: IntArray): Int {
        var slow = 0
        for (fast in 1 until nums.size) {
            if (nums[fast] != nums[slow]) {
                slow++
                nums[slow] = nums[fast]
            }
        }
        return  slow + 1
    }
}